import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StandardVO, StandardForm, StandardQuery } from '@/api/business/standard/types';

/**
 * 查询费用项设置列表
 * @param query
 * @returns {*}
 */

export const listStandard = (query?: StandardQuery): AxiosPromise<StandardVO[]> => {
  return request({
    url: '/business/standard/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询费用项设置详细
 * @param chargeId
 */
export const getStandard = (chargeId: string | number): AxiosPromise<StandardVO> => {
  return request({
    url: '/business/standard/' + chargeId,
    method: 'get'
  });
};

/**
 * 新增费用项设置
 * @param data
 */
export const addStandard = (data: StandardForm) => {
  return request({
    url: '/business/standard',
    method: 'post',
    data: data
  });
};

/**
 * 修改费用项设置
 * @param data
 */
export const updateStandard = (data: StandardForm) => {
  return request({
    url: '/business/standard',
    method: 'put',
    data: data
  });
};

/**
 * 删除费用项设置
 * @param chargeId
 */
export const delStandard = (chargeId: string | number | Array<string | number>) => {
  return request({
    url: '/business/standard/' + chargeId,
    method: 'delete'
  });
};
